package com.example.demofdfs.example.link;

import java.util.Iterator;
import java.util.function.Consumer;

public class DoubleLinkedTest {

	public static void main(String[] args) throws CloneNotSupportedException, InterruptedException {
		Links<String> link = new DoubleLinked<String>();
		for(int i = 0; i < 10; i++) {
			link.add("link-" + i);
		}
		System.out.println(link);
//		System.out.println(link.get(0));
//		System.out.println(link.get(link.size() - 1));
//		System.out.println(link.get(2));
//		System.out.println(link.get(-1));
//		System.out.println(link);
//		System.out.println(link.remove(0));
//		System.out.println(link);
//		System.out.println(link.remove(link.size() - 1));
//		System.out.println(link);
//		System.out.println(link.remove(link.size()));
//		System.out.println(link);
//		System.out.println(link.set(7, "newNode - *"));
//		System.out.println(link);
//		System.out.println(link.set(1, "newNode - *"));
//		System.out.println(link);
	
//		link.forEach(new Consumer<String>() {
//
//			@Override
//			public void accept(String t) {
//				System.out.println(t);
//			}
//		});
		
//		Object object = ((DoubleLinked<String>)link).clone();
//		System.out.println(object);
//		System.out.println(link);
//		System.out.println(link.size());
//		System.out.println(object.hashCode() + "  :  " + link.hashCode());
		
		Iterator<String> it = link.iterator();
		while(it.hasNext()) {
			System.out.println(it.next());
			it.remove();
//			link.add("node-id *");
		}
		System.out.println(link);
		it.remove();
//		it.next();
	}

}
